package com.w.picture.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.w.picture.mode.dto.user.UserAddRequest;
import com.w.picture.mode.dto.user.UserLoginRequest;
import com.w.picture.mode.dto.user.UserQueryRequest;
import com.w.picture.mode.dto.user.UserRegisterRequest;
import com.w.picture.mode.entity.User;
import com.w.picture.mode.vo.LoginUserVo;
import com.w.picture.mode.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author w
 * @description 针对表【user(用户)】的数据库操作Service
 * @createDate 2024-12-15 16:12:35
 */
public interface UserService extends IService<User> {

    /**
     * 用户注册
     *
     * @param request 注册请求
     * @return 用户ID
     */
    public long userRegister(UserRegisterRequest request);

    /**
     * 用户登录
     *
     * @param request 登录请求
     * @param httpServletRequest 请求
     * @return 登录用户
     */
    public LoginUserVo userLogin(UserLoginRequest request, HttpServletRequest httpServletRequest);

    /**
     * 获取当前登录用户
     * @param request 请求
     * @return 登录用户
     */
    User getLoginUser(HttpServletRequest request);

    /**
     * 用户注销
     * @param request 请求
     * @return 退出状态
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 是否为管理员
     * @param user 用户
     * @return true/false
     */
    boolean isAdmin(User user);

    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);

    UserVo getUserVo(User user);
    List<UserVo> getUserVoList(List<User> userList);

    User getUserByUserAccount(String userAccount);

    User getUserByShareCode(String shareCode);

    boolean checkUserAccount(String userAccount);

    String encryptPassword(String password);

    LoginUserVo getLoginUserVo(User user);
}
